<!-- 购物车 -->
<template>
  <div id="cart">
    <nav-bar class="nav-bar">
      <div slot="center">购物车({{ cartLength }})</div>
    </nav-bar>
    <scroll class="cart-scroll">
      <cart-list></cart-list>
    </scroll>
    <cart-bottom-bar></cart-bottom-bar>
  </div>
</template>

<script>
import NavBar from 'components/common/navbar/NavBar';
import CartList from 'views/cart/childComps/CartList'
import { mapGetters } from 'vuex';
import Scroll from 'components/common/scroll/Scroll';
import CartBottomBar from 'views/cart/childComps/CartBottomBar';

export default {
  name: 'Cart',
  data () {
    return {
    };
  },
  components: {
    NavBar,
    CartList,
    Scroll,
    CartBottomBar
  },
  computed: {
    // 第一种语法
    // ...mapGetters(['cartLength']),
    // 第二种语法
    ...mapGetters({
      cartLength : 'cartLength'
    })
  }
}

</script>
<style scoped>
#cart {
  height: 100vh;
}

.nav-bar {
  background-color: var(--color-tint);
  color: #fff;
  font-weight: 400;
}

.cart-scroll {
  height: calc(100% - 49px - 44px - 40px);
  overflow: hidden;
}
</style>